//
//  InteractHomeTableViewCell.m
//  AnXin100
//
//  Created by 王合润 on 10/16/18.
//  Copyright © 2018 tzhg. All rights reserved.
//

#import "InteractHomeTableViewCell.h"

@interface InteractHomeTableViewCell ()



@end

@implementation InteractHomeTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self creatCell];
    }
    return self;
}

- (void)creatCell {
    NSArray *titleAry = @[@"官方自媒体", @"基地溯源", @"消费者体验"];
    NSArray *imageNameAry = @[@"officialMedia", @"laden", @"consumer"];
    for (NSInteger i = 0; i < 3; i++) {
        UIButton *btn = [UIButton new];
        btn.frame = CGRectMake(SCREEN_WIDTH / 3 * i, 0, SCREEN_WIDTH / 3, 130);
        [btn setTitle:titleAry[i] forState:UIControlStateNormal];
        btn.titleLabel.font = [UIFont systemFontOfSize:14];
        [btn setTitleColor:[UIColor colorWithHex:0x333333] forState:UIControlStateNormal];
        [btn setImage:[UIImage imageNamed:imageNameAry[i]] forState:UIControlStateNormal];
        [btn setButtonLayout:CHButtonLayoutTitleBottom offset:0];
        btn.tag = 100 + i;
        [btn addTarget:self action:@selector(btnAction:) forControlEvents:UIControlEventTouchUpInside];
        [self addSubview:btn];
    }
}

- (void)btnAction:(UIButton *)sender {
    self.btnClick(sender.tag - 100);
}

- (void)awakeFromNib {
    [super awakeFromNib];
    
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
